﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading;
using System.Reflection;
using UcAsp.Net.BLL;
using UcAsp.Net.Model;
namespace UcAsp.Net.Web.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            BLL.SettingConfig.Theme(Request.UserAgent);
           // List<CategoriesTree> list = new BLL.CategoriesBLL().GetCategoriessPath(61);
            //Response.Redirect("/Categories/Express");
           // Response.End();
            //int pageindex = Convert.ToInt16(Request.QueryString["i"]) == 0 ? 0 : Convert.ToInt16(Request.QueryString["i"]);
            //int id =Request.QueryString["id"]==null?int.Parse(BLL.SysParamBLL.GetParamByName("IndexID")): int.Parse(Request.QueryString["id"].ToString());
            //int pagecount = 0;
            //List<Model.Articles> list = new BLL.ArticlesBLL().Select(0, id, false, true, null, int.Parse(SysParamBLL.GetParamByName("IndexShowNo")), pageindex, out pagecount);
            //if (json != null) {                
            //    return Json(list, JsonRequestBehavior.AllowGet);
            //}
            //ViewData["IsLogin"]=false;
            //if (Session["UserID"] != null)
            //{ ViewData["IsLogin"] = true; }
            return View("~/themes/" + BLL.SettingConfig.GetSiteSetting.Theme + "/Home/Index.cshtml");
        }

        public ActionResult Recommad()
        {
            BLL.SettingConfig.Theme(Request.UserAgent);
            return View();
        }
        //public ActionResult MyIndex(string json)
        //{
        //    if (Session["UserID"] == null)
        //    {
        //        Response.Redirect("/");
        //        Response.End();
        //        return View(new List<Model.Articles>());
        //    }
        //    else
        //    {
        //        int pageindex = Convert.ToInt16(Request.QueryString["i"]) == 0 ? 0 : Convert.ToInt16(Request.QueryString["i"]);

        //        int pagecount = 0;
        //        List<Model.Articles> list = new BLL.ArticlesBLL().Select(int.Parse(Session["UserID"].ToString()), null, false, true, null, 20, pageindex, out pagecount);
        //        if (json != null)
        //        {
        //            return Json(list, JsonRequestBehavior.AllowGet);
        //        }
        //        return View(list);
        //    }
        //}
        
    }
}
